<div class="blazorise-codeblock">
<div class="csharp"><pre>
<span class="keyword">private</span> <span class="keyword">async</span> Task RegisterAccount()
{
    <span class="keyword">if</span> (!CanRegister) <span class="keyword">return</span>;
    <span class="keyword">try</span>
    {
        <span class="keyword">var</span> result = <span class="keyword">await</span> _accountRepo.RegisterUser(RegisterModel);
        RegistrationSucceeded = <span class="keyword">true</span>;
        _navManager.NavigateTo(<span class="string">&quot;/account/login&quot;</span>);
    }
    <span class="keyword">catch</span> (Exception e)
    {
        Console.WriteLine(e);
        <span class="keyword">throw</span>;
    }
}
</pre></div>
</div>
